package com.zl.smartmall.library.po;

import org.json.JSONException;
import org.json.JSONObject;

public class WechatPayInfo {

	private long timeStamp;
	private String nonceStr;
	private String packageValue;
	private String sign;
	private String sn;
	private String orderTitle;
	private String partnerId;
	private String prePayId;

	public String getPartnerId() {
		return partnerId;
	}

	public void setPartnerId(String partnerId) {
		this.partnerId = partnerId;
	}

	public long getTimeStamp() {
		return timeStamp;
	}

	public void setTimeStamp(long timeStamp) {
		this.timeStamp = timeStamp;
	}

	public String getNonceStr() {
		return nonceStr;
	}

	public void setNonceStr(String nonceStr) {
		this.nonceStr = nonceStr;
	}

	public String getPackageValue() {
		return packageValue;
	}

	public void setPackageValue(String packageValue) {
		this.packageValue = packageValue;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public String getSn() {
		return sn;
	}

	public void setSn(String sn) {
		this.sn = sn;
	}

	public String getOrderTitle() {
		return orderTitle;
	}

	public void setOrderTitle(String orderTitle) {
		this.orderTitle = orderTitle;
	}
	
	public String getPrePayId() {
		return prePayId;
	}

	public void setPrePayId(String prePayId) {
		this.prePayId = prePayId;
	}

	public static WechatPayInfo parse(JSONObject jsonObject) throws JSONException {
		if(jsonObject != null && jsonObject.length() > 0) {
			WechatPayInfo info = new WechatPayInfo();
			info.nonceStr = jsonObject.getString("noncestr");
			info.orderTitle = jsonObject.getString("orderTitle");
			info.packageValue = jsonObject.getString("packageValue");
			info.partnerId = jsonObject.getString("partnerId");
//			info.sign = jsonObject.getString("newSign");
			info.sign = jsonObject.getString("sign");
			info.sn = jsonObject.getString("sn");
			info.timeStamp = jsonObject.getLong("timeStamp");
			info.prePayId = jsonObject.getString("prepayid");
			return info;
		}
		
		return null;
	}

}
